package com.jxs.android.weiget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.telecom.weixi.R;

public class BuSalesItem extends LinearLayout {

	private TextView index, content, date_1, date_2, date_3;

	public BuSalesItem(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	public BuSalesItem(Context context) {
		this(context, null);
		init(context);
	}

	private void init(Context context) {
		LayoutInflater.from(context).inflate(R.layout.bu_sales_table_item, this);

		index = (TextView) findViewById(R.id.index);
		content = (TextView) findViewById(R.id.content);
		date_1 = (TextView) findViewById(R.id.date_1);
		date_2 = (TextView) findViewById(R.id.date_2);
		date_3 = (TextView) findViewById(R.id.date_3);
	}

	public void setBackgroud(int resid) {
		index.setBackgroundResource(resid);
		content.setBackgroundResource(resid);
		date_1.setBackgroundResource(resid);
		date_2.setBackgroundResource(resid);
		date_3.setBackgroundResource(resid);
	}

	public void setValue(String i_index, String i_content, String i_date_1, String i_date_2, String i_date_3) {
		index.setText(i_index);
		content.setText(i_content);
		date_1.setText(i_date_1);
		date_2.setText(i_date_2);
		date_3.setText(i_date_3);
	}

	public void setContentGravityCenter() {
		content.setGravity(Gravity.CENTER);
	}

}
